<?PHP
if (!session_start()) { session_start(); };
/*if (!isset($_SESSION['lgnapproved'])) {
	die(header('Location: login.php'));
}*/
include("functions.php");
include("cnnxn.php");
connect();

$SQLview='SELECT * FROM av_events ORDER BY eventdate DESC;';
$sendit_view=mysqli_query($db,$SQLview) or die(mysqli_error($db));

$thisYear=date("Y");
$years=$thisYear-3;
$followingYears=$thisYear+3;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>daleclark.net</title>
<link type="text/css" rel="stylesheet" href="adminstyles.css" />
</head>
<body>
<div id="adminwrapper">
<div id="adminlogo"></div>
<?PHP navigation(); ?>
<div id="admincontent">
<h2>Events</h2>

<div style="float:left; width:500px; padding-right:25px; margin-right:25px; border-right:1px solid #FFFFFF;">

<?PHP 
$backgroundcolor="#2883D4";
while ($RSview=mysqli_fetch_object($sendit_view)) {
	if ($backgroundcolor=="#2883D4") {
		$backgroundcolor="#2F93E9";
	} else {
		$backgroundcolor="#2883D4";
	}
	print '<div style="background:'.$backgroundcolor.'; width:500px; padding:2px 2px 2px 5px;"><span class="deletespan"><a href="av_events_del.php?id='.$RSview->id.'" class="deletelink" title="DELETE" onclick="return confirm(\'Are sure you want to PERMANENTLY DELETE this Event and all associated results?\')"><img src="../images/icon_delete.png" height="12px" border="0" /></a></span><span class="column01span"><a href="av_events_mod.php?id='.$RSview->id.'">'.$RSview->eventdate.'</a></span><span class="column02span"><a href="av_eventresults.php?eid='.$RSview->id.'">Results</a></span><div class="clear"></div></div>';
}
?>
<div class="clear"></div>
<p>&nbsp;</p>
</div>
<div style="float:left; width:500px;">

<h3>Add an Event</h3>
<form name="addForm" method="POST" action="av_events_add.php">
<!-- <p><span class="label">Event Name</span><span class="inputbox"><input name="eventname" type="text" /></span></p> -->
<p>Event day: <input name="eventdate_day" type="text" style="width:25px;" />
 month: <select name="eventdate_month">
<option value="01"<?PHP if (date("m")==01) { print ' selected'; } ?>>01</option>
<option value="02"<?PHP if (date("m")==02) { print ' selected'; } ?>>02</option>
<option value="03"<?PHP if (date("m")==03) { print ' selected'; } ?>>03</option>
<option value="04"<?PHP if (date("m")==04) { print ' selected'; } ?>>04</option>
<option value="05"<?PHP if (date("m")==05) { print ' selected'; } ?>>05</option>
<option value="06"<?PHP if (date("m")==06) { print ' selected'; } ?>>06</option>
<option value="07"<?PHP if (date("m")==07) { print ' selected'; } ?>>07</option>
<option value="08"<?PHP if (date("m")==08) { print ' selected'; } ?>>08</option>
<option value="09"<?PHP if (date("m")==09) { print ' selected'; } ?>>09</option>
<option value="10"<?PHP if (date("m")==10) { print ' selected'; } ?>>10</option>
<option value="11"<?PHP if (date("m")==11) { print ' selected'; } ?>>11</option>
<option value="12"<?PHP if (date("m")==12) { print ' selected'; } ?>>12</option>
</select>
 year: <select name="eventdate_year">
<?PHP
while ($years<=$followingYears) {
	$years++;
	print '<option value="'.$years.'"';
	if ($years==$thisYear) {
		print ' selected';
	}
	print '> '.$years.' </option>';
}
?>
</select></p>
<input type="submit" value="submit" name="submit" /></form>

</div>
</div>
</div>
</body>
</html>
<?PHP
mysqli_close($db);
?>